package jpaperwork.web;

import org.mortbay.jetty.Server;
import org.mortbay.jetty.webapp.WebAppContext;

public class JettyServer {
    private Server server;


    public static void main(String[] args) throws Exception {
        JettyServer webServer = new JettyServer(9999);
        webServer.join();
    }

    public JettyServer(int port) throws Exception {
        server = new Server(port);
        WebAppContext webAppContext = new WebAppContext("web-example/web", "/jpaperwork");

		server.addHandler(webAppContext);
        server.setStopAtShutdown(true);
        server.start();
    }

    private void join() throws InterruptedException {
        server.join();
    }

    public void stop() throws Exception {
        server.stop();
    }
}
